﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp20
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Collections.ArrayList list = new System.Collections.ArrayList()
            { "aac","def","abc","buf","ijh"};
            int index = list.IndexOf("abc");
            if (index != 0)
            {
                Console.WriteLine( "集合中存在abc元素");
            }
            else
            {
                Console.WriteLine("集合中不存在abc元素");
            }
            Console.WriteLine();

            System.Collections.ArrayList lista = new System.Collections.ArrayList()
            { "aac","def","abc","buf","ijh"};
            for (int i=0;i<list.Count; i = i + 2)
            {
                lista.Add(list[i]);
            }
            foreach (var a in lista)
            {
                Console.WriteLine(a);
            }
            Console.WriteLine();

            System.Collections.ArrayList listb = new System.Collections.ArrayList()
            { "aac","def","abc","buf","ijh"};
            System.Collections.ArrayList insertList = new System.Collections.ArrayList()
            { "x","y","z"};
            listb.InsertRange(1, insertList);
            foreach (var b in listb)
            {
                Console.WriteLine(b);
            }
            Console.WriteLine();

            System.Collections.ArrayList listc = new System.Collections.ArrayList()
            { "aac","def","abc","buf","ijh"};
            listc.Sort();
            foreach (var c in listc)
            {
                Console.WriteLine(c);
            }
        }
    }
}
